FROM docker.linkos.org/nvidia/cuda:12.8.0-base-ubuntu22.04
ARG MODEL_FILE
ARG PROMPT_TEMPLATE
ARG MODEL_NAME
ENV DEBIAN_FRONTEND=noninteractive
ENV LLMDATA=/app/model
ENV MODEL_FILE=${MODEL_FILE}
ENV PROMPT_TEMPLATE=${PROMPT_TEMPLATE}
ENV MODEL_NAME=${MODEL_NAME}
WORKDIR /app
# RUN sed -i s:/archive.ubuntu.com/:/mirrors.volces.com/:g /etc/apt/sources.list.d/ubuntu.sources
# sed -i s:/archive.ubuntu.com/:/mirrors.aliyun.com/:g /etc/apt/sources.list.d/ubuntu.sources && \
RUN sed -i s:/archive.ubuntu.com/:/mirrors.aliyun.com/:g /etc/apt/sources.list &&\
  apt-get update && apt-get install -y curl wget git libcublas-12-8 libgomp1

# COPY ./install_cuda_amd64.sh /app
COPY ./clean.sh /app
# COPY ./wasmedge_install.sh /app
COPY ./wasmedge_install_v2.sh /app
COPY ./down_llama_api_server.sh /app
# COPY ./down_rag_api_server.sh /app
# RUN sh down_rag_api_server.sh sh install_cuda_amd64.sh && sh delete_cuda_amd64.sh
# RUN sh install_cuda_amd64.sh && sh wasmedge_install.sh && sh down_llama_api_server.sh && sh delete_cuda_amd64.sh
RUN cat wasmedge_install_v2.sh | bash -s -- -c 12 -v 0.14.1 && sh down_llama_api_server.sh && sh clean.sh


# WORKDIR /app
COPY ./init.sh /app
RUN mkdir model && chmod +x init.sh
EXPOSE 8080
# Execute api server
ENTRYPOINT ["nohup", "/app/init.sh"]
